#ifndef USER_H
#define USER_H

#include "lists.h"

#define MAX_USER_NUM  255
#define USER_NAME_SIZE 32

struct user
{
    const char* name;

    int port;

    TGAP_LIST_ENTRY(user) field;
};

extern struct user self;

TGAP_LIST_HEAD_NOLOCK(UserTable, user);


int User_Init(int port, const char* name);

struct user* User_QueryByName(const char* name);
struct user* User_QueryByPort(int port);
struct user* User_Add(int port, const char* name);
struct user* User_RemoveByPort(int port);

void PrintUserTable();

#endif